package ms.actuator.job.config;

import ms.actuator.job.service.AedApiInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * 请求第三方接口必备参数初始化到内存
 * @Author ybc
 * @Date 2021/6/24 16:31
 */
@Component
public class ReqParamsConfig implements ApplicationListener<ContextRefreshedEvent> {

    private final AedApiInfoService aedApiInfoService;

    @Autowired
    public ReqParamsConfig(AedApiInfoService aedApiInfoService) {
        this.aedApiInfoService = aedApiInfoService;
    }

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        aedApiInfoService.putInfo2Cache();
    }
}
